﻿using System;
using System.Collections;

namespace ConsoleApp17
{
    class Program
    {
        static void Main(string[] args)
        {
            SortedList sortedlist = new SortedList();
            sortedlist.Add(1, "html");
            sortedlist.Add(2, "java");
            sortedlist.Add(3, "sql");
            sortedlist.Add(4, "c#");
            Console.WriteLine("请选择你要学习的内容");
            int id = int.Parse(Console.ReadLine());
            bool x = sortedlist.ContainsKey(id);
            if (x)
            {
                string name = sortedlist[id].ToString();
                Console.WriteLine("你要学的内容：{0}",name);
            }
            else
            {
                Console.WriteLine("对不起，没有你想学的内容");
            }
            Console.WriteLine();
            Console.WriteLine("所有的学习内容如下：");
            foreach (DictionaryEntry d in sortedlist)
            {
                int key = (int)d.Key;
                string value = d.Value.ToString();
                Console.WriteLine("编号：{0}，学习内容：{1}", key, value);
            }



        }
    }
}
